package com.controller.medical;

import com.comm.R;
import com.entity.DrugBill;
import com.entity.DrugOrder;
import io.swagger.annotations.*;
import org.springframework.web.bind.annotation.*;

import java.sql.Timestamp;

@RestController
@RequestMapping("/medicine/process")
@Api(value = "药品进销存模块",tags = "入库审核的所有接口API")
@ApiResponses({
        @ApiResponse(code=200,message="请求成功"),
        @ApiResponse(code=404,message="找不到页面"),
        @ApiResponse(code=405,message="请求方法错误"),
        @ApiResponse(code=500,message="后台服务错误")
})
public class ProcessController {

    //查询所有单据
    @RequestMapping(value = "/findAllBill", method = RequestMethod.GET)
    @ApiOperation(value = "查询所有单据", notes = "查询所有单据", httpMethod = "GET", response = R.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "currentPage",value = "当前页",paramType = "query",dataType = "String",required = true),
            @ApiImplicitParam(name = "pageSize",value = "每页的条数",paramType = "query",dataType = "String",required = true),
            @ApiImplicitParam(name = "id", value = "制单号", paramType = "query", dataType = "int", required = false),
            @ApiImplicitParam(name = "supName", value = "供应商", paramType = "query", dataType = "String", required = false),
            @ApiImplicitParam(name = "purchTime", value = "采购日期", paramType = "query", dataType = "Timestamp", required = false)
    })
    @ResponseBody
    public R findAllBill(@ApiParam() String currentPage,String pageSize,Integer id,String supName, Timestamp purchTime)  {
        R r = new R();
        r.setCode(200);
        r.setMsg("查询成功");
        String data = "{\n" +
                "\t\"id\": 202302170000100045,\n" +
                "\t\"purchaser\": \"院长A\",\n" +
                "\t\"purchTime\": \"2023 - 02 - 17\",\n" +
                "\t\"checker\": \"院长A\",\n" +
                "\t\"checkTime\": \"2023-02-17 16:41:00\",\n" +
                "\t\"supName\": \"FT\",\n" +
                "\t\"allTrade\": \"200\",\n" +
                "\t\"allPre\": \"400\",\n" +
                "\t\"status\": 1\n" +
                "}";
        r.setData(data);
        return r;
    }

    //查看当前编号采购单详情
    @RequestMapping(value = "/findOrderByBillId", method = RequestMethod.GET)
    @ApiOperation(value = "查看当前编号采购单详情", notes = "查看当前编号采购单详情", httpMethod = "GET", response = R.class)
    @ApiImplicitParam(name = "bill_id", value = "单据号", paramType = "query", dataType = "int", required = false)
    @ResponseBody
    public R findOrderByBillId(@RequestBody @ApiParam(name = "drugOrder", value = "采购单实体", required = true) DrugOrder drugOrder) {
        R r = new R();
        r.setCode(200);
        r.setMsg("查询成功");
        String data = "{\n" +
                "\t\"id\": 1,\n" +
                "\t\"drug_name\": \"烫骨碎补\",\n" +
                "\t\"sepc\": \"1g\",\n" +
                "\t\"factory\": \"院长A\",\n" +
                "\t\"number\": 20,\n" +
                "\t\"remark\": \"g\",\n" +
                "\t\"trade\": \"10.00\",\n" +
                "\t\"prescription\": \"50.00\",\n" +
                "\t\"trades\": 200.00,\n" +
                "\t\"pres\": 1000.00,\n" +
                "\t\"bill_id\": 202302170000100044\n" +
                "}";
        r.setData(data);
        return r;
    }
    //删除订单
    @RequestMapping(value = "/deleteBill", method = RequestMethod.GET)
    @ApiOperation(value = "删除订单", notes = "删除订单", httpMethod = "GET", response = R.class)
    @ApiImplicitParam(name = "id", value = "制单号", paramType = "query", dataType = "int", required = false)
    @ResponseBody
    public R deleteBill() {
        R r = new R();
        r.setCode(200);
        r.setMsg("删除成功！");

        return r;

    }

    //审核
    @RequestMapping(value = "/check", method = RequestMethod.POST)
    @ApiOperation(value = "审核", notes = "审核", httpMethod = "post", response = R.class)
    @ApiImplicitParam(name = "id", value = "制单号", paramType = "query", dataType = "int", required = false)
    @ResponseBody
    public R updatePrice() {
        R r = new R();
        r.setCode(200);
        r.setMsg("审核成功");
        return r;
    }

}

